package com.ymatou.shoppingcart.api.service;

import org.json.JSONObject;

import com.ymt.base.YmatouBaseCall;
import com.ymttest.utils.EnvSetup;

/**
 * 根据CartId列表删除购物车中记录Call FreeMaker Template自动生成代码
 */
public class BatchDeleteCatalogFromCartCall extends YmatouBaseCall {
	private static String opurl = "api/operate/BatchDeleteCatalogFromCart";

	public BatchDeleteCatalogFromCartCall() {
		super(EnvSetup.getSystemUrl("api_shoppingcart"), opurl, "POST", "JSON");
	}

	/**
	 * 获取Code
	 * 
	 * @return Code
	 */
	public String getCode() {
		String Code = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Code = String.valueOf(jo.get("Code"));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return Code;
	}

	/**
	 * 获取BCode
	 * 
	 * @return BCode
	 */
	public String getBCode() {
		String BCode = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			BCode = String.valueOf(jo.get("BCode"));

		} catch (Exception e) {
			e.printStackTrace();
		}
		return BCode;
	}

	/**
	 * 获取Msg
	 * 
	 * @return Msg
	 */
	public String getMsg() {
		String Msg = null;
		try {
			JSONObject jo = new JSONObject(getReturnData());
			Msg = (String) jo.get("Msg");

		} catch (Exception e) {
			e.printStackTrace();
		}
		return Msg;
	}

	@Override
	public void addDefHeader() {
		// super.addDefHeader();
		client.addHeader("Accept", "text/xml,text/javascript,text/html,application/json");
		client.addHeader("Content-Type", "application/json; charset=UTF-8");
	}
}